home *** CD-ROM | disk | FTP | other *** search
/ infoROM 17,000 Product Descriptions for Business / infoROM Product Descriptions for Business - ESX Interactive.ISO / argdemos / nexsys / pcl.atl < prev    next >
Encoding:
Text File  |  1993-06-21  |  3.2 KB  |  132 lines

  1. \ Atlas Plotter Driver:
  2. \ Laserjet II - Hewlett-Packard Printer Control Language (PCL)
  3. \
  4. \ File: PCL.ATL
  5. \
  6. \ Copyright (C) 1993 by Derrick Oswald
  7. \
  8. \ Derrick Oswald
  9. \ Nexsys Consulting Inc.
  10. \ 44 Douglas Drive
  11. \ Ayr, Ontario
  12. \ N0B 1E0
  13. \ (519) 632-8243
  14. \ (519) 632-8244 FAX
  15.  
  16. \ Description:
  17. \      Example Hewlett-Packard Printer Control Language plotter driver
  18. \      for use with SEE versions greater than 26.78, and OVLY versions
  19. \      greater than 4.10. Written in ATLAS (Autodesk Threaded Language
  20. \      Application System) it demonstrates creating the required words
  21. \      to generate a plot and can be used as a template for further
  22. \      development.
  23. \       
  24. \ For the program to use this driver 4 words must be defined:
  25. \
  26. \  "INITPLOTTER"      - sets up any code or data required
  27. \  "CLEARPLOTTER"     - initialize a new plot (form feed)
  28. \  "CLOSEPLOTTER"     - shuts down the plotting system
  29. \  "IMAGEPLOTTER"     - output one row of pixels
  30.  
  31. : plotter ; \ use this word to forget this whole file
  32.  
  33. .( "\nLoading PCL plotter driver"
  34.  
  35. 300.0 2constant resolution
  36.  
  37. \ X dimension set at 8.0" * 300 dpi = 2400
  38. 8.0 resolution f* fix constant maxdimx 
  39. \ Y dimension set at 13.1667" * 300 dpi = 3950
  40. 13.1667 resolution f* fix constant maxdimy 
  41.  
  42. \ byte_width - convert number of bits to bytes
  43. : byte_width ( bits -> bytes )
  44.   7 + -3 shift
  45. ;
  46.  
  47. DEVICE PCL
  48.  
  49. \ declare the plotsize array
  50. 2 1 ptrsize realsize + realsize + array plotsize
  51.  
  52. \ plotsize access words
  53. : &plotsize.name ( n -> addr ) plotsize ;
  54. : &plotsize.x ( n -> addr ) plotsize ptrsize + ;
  55. : &plotsize.y ( n -> addr ) plotsize ptrsize + realsize + ;
  56.  
  57. .( "\nINITPLOTTER - set up code and data"
  58. : INITPLOTTER ( -> [PDEVICE pDevice] )
  59.  
  60.   OUTPUTIMAGE PCL ->Output !
  61.   0 PCL ->Left !
  62.   maxdimx PCL ->Right !
  63.   0 PCL ->Top !
  64.   maxdimy PCL ->Bottom !
  65.   10000 dup PCL ->Xasp ! PCL ->Yasp !
  66.   1 PCL ->Threshold !
  67.   1 PCL ->HiValue !
  68.  
  69.   "letter" 0 &plotsize.name !
  70.   8.0 0 &plotsize.x real!
  71.   10.5 0 &plotsize.y real!
  72.   "MAX" 1 &plotsize.name !
  73.   8.0 1 &plotsize.x real!
  74.   13.1667 1 &plotsize.y real!
  75.  
  76.   -1 resolution 0 plotsize 2 PCL getuser
  77.  
  78.   if
  79.     ." "\ncan't get user info"
  80.     0                     \ return NULL
  81.   else
  82.     PCL                 \ return device structure
  83.   then
  84. ;
  85.  
  86. : IMAGEPLOTTER ( ImageData width line -> )
  87.   drop                    \ drop line (redundant)
  88.   "\e*b" outs             \ prefix with number of bytes
  89.   byte_width dup outn     \ ( address bytecount bytecount -> )
  90.   "W" outs
  91.  
  92.   \ send graphics data
  93.   swap                    \ ( bytecount address -> )
  94.   output
  95. ;
  96.  
  97. \ reset - sends the reset code to the plotter
  98. : reset ( -> )
  99.   "\eE" outs
  100. ;
  101.  
  102. \ set_resolution - sets the raster resolution 
  103. : set_resolution ( n -> )
  104.   "\e*t" outs
  105.   outn
  106.   "R" outs
  107. ;
  108.  
  109. \ formfeed - issues formfeed
  110. : formfeed ( -> )
  111.   12 outch
  112. ;
  113.  
  114. .( "\nCLEARPLOTTER - initialize a new plot"
  115. : CLEARPLOTTER ( -> )
  116.   reset                   \ reset defaults
  117.  
  118.   \ set graphics resolution
  119.   resolution fix set_resolution
  120.  
  121.   "\e*r1A" outs           \ start graphics
  122. ;
  123.  
  124. .( "\nCLOSEPLOTTER - finish a plot"
  125. : CLOSEPLOTTER ( -> )
  126.   "\e*rB" outs            \ end graphics
  127.   formfeed                \ perform formfeed to eject paper
  128. ;
  129.  
  130. .( "\nLoaded.\n"
  131.  
  132.